#include <iostream>
#include <stdio.h>
#include <string.h>
#include <assert.h>

using namespace std;

#define INITVALUE 7
#define mydebug
char m[] = "ABCDEFGHIJKL";
char lstr[] = "light";
char rstr[] = "heavy";

int main() {
    int count;
    char left[10], right[10], weight[10];
    int r[12];
    int ln[10], rn[10];
    cin >> count;
    for (int i = 0; i < count; i++) {
        for (int j = 0; j < 12; j++) {
            r[j] = INITVALUE;
        }
        for (int j = 0; j < 3; j++) {
            cin >> left >> right >> weight;
            mydebug("left is %s, right is %s, weight is %s\n", left, right, weight);
            if (strcmp(weight, "even") == 0) {
                for (size_t k = 0; k < strlen(left); k++) {
                    ln[k] = left[k] - 'A';
                    rn[k] = right[k] - 'A';
                    r[ln[k]] = 0;
                    r[rn[k]] = 0;
                }
                mydebug("the r is :");
                for (int i = 0; i < 12; i++) {
                    mydebug("%c%d ",m[i], r[i]);
                }
                mydebug("\n");
            } else if (strcmp(weight, "down") == 0) {
                for (size_t k = 0; k < strlen(left); k++) {
                    ln[k] = left[k] - 'A';
                    rn[k] = right[k] - 'A';
                }
                for (size_t k = 0; k < strlen(left); k++) {
                    if (r[ln[k]] == 0) {
                        // do nothing
                    } else if (r[ln[k]] == INITVALUE) {
                        r[ln[k]] = -1;
                        mydebug("%c has been marked as light\n", m[ln[k]]);
                    } else if (r[ln[k]] > 0) {
                        r[ln[k]] = 0;
                    } else {
                        r[ln[k]]--;
                    }
                }
                for (size_t k = 0; k < strlen(left); k++) {
                    if (r[rn[k]] == 0) {
                        // do nothing
                    } else if (r[rn[k]] == INITVALUE) {
                        r[rn[k]] = 1;
                        mydebug("%c has been marked as heavy\n", m[rn[k]]);
                    } else if (r[rn[k]] < 0) {
                        r[rn[k]] = 0;
                    } else {
                        r[rn[k]]++;
                    }
                }
                 mydebug("the r is :");
                for (int i = 0; i < 12; i++) {
                    mydebug("%c%d ",m[i], r[i]);
                }
                mydebug("\n");
            } else if (strcmp(weight, "up") == 0) {
                for (size_t k = 0; k < strlen(left); k++) {
                    ln[k] = left[k] - 'A';
                    rn[k] = right[k] - 'A';
                }

                for (size_t k = 0; k < strlen(left); k++) {
                    if (r[ln[k]] == 0) {
                        // do nothing
                    } else if (r[ln[k]] == INITVALUE) {
                        r[ln[k]] = 1;
                        mydebug("%c has been marked as heavy\n", m[ln[k]]);
                    } else if (r[ln[k]] < 0) {
                        r[ln[k]] = 0;
                    } else {
                        r[ln[k]]++;
                    }
                }
                for (size_t k = 0; k < strlen(left); k++) {
                    if (r[rn[k]] == 0) {
                        // do nothing
                    } else if (r[rn[k]] == INITVALUE) {
                        r[rn[k]] = -1;
                        mydebug("%c has been marked as light\n", m[rn[k]]);
                    } else if (r[rn[k]] > 0) {
                        r[rn[k]] = 0;
                    } else {
                        r[rn[k]]--;
                    }
                }
                 mydebug("the r is :");
                for (int i = 0; i < 12; i++) {
                    mydebug("%c%d ",m[i], r[i]);
                }
                mydebug("\n");
            } else {
                assert(1 == 0);
            }
        }
        char index = 'X';
        char dir[10] = "nothing";
        int aa = 0;
        for (int j = 0; j < 12; j++) {
            if (abs(r[j]) > aa && r[j] != INITVALUE) {
                index = m[j];
                if (r[j] < 0) {
                    strcpy(dir, lstr);
                } else {
                    strcpy(dir, rstr);
                }
                aa = abs(r[j]);
            }
        }
        cout << index << " is the counterfeit coin and it is " << dir << "." << endl;
    }
    return 0;
}

